package com.pearlsoft.webapp.rms.projectuse.service;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.pearlsoft.webapp.core.dao.RecrodRowMapper;
import com.pearlsoft.webapp.core.dataset.Record;
import com.pearlsoft.webapp.core.dataset.SimpleRecord;

public class ProjectuseRowMapperHelper {
	public static RecrodRowMapper<Record> generalRowMapper(){
		return new  RecrodRowMapper<Record>(){
			@Override
			public Record mapRow(ResultSet rs, int rowNum)
					throws SQLException {
				SimpleRecord recrod = new SimpleRecord();
				recrod.setValue("id", rs.getString(1));
				recrod.setValue("projectname", rs.getString(2));
				recrod.setValue("hostname", rs.getString(3));
				recrod.setValue("week", rs.getString(4));
				recrod.setValue("cpuavg", rs.getInt(5));
				recrod.setValue("cpupeak", rs.getString(6));
				recrod.setValue("memoryavg", rs.getString(7));
				recrod.setValue("memorypeak", rs.getString(8));
				recrod.setValue("diskuse", rs.getString(9));
				return recrod;
			}
		};
	}

}
